package com.thrd.taiexhibition.presener;

import com.thrd.taiexhibition.bean.BeanCityHome;
import com.thrd.taiexhibition.callback.MvpCallback;
import com.thrd.taiexhibition.model.CityModel;
import com.thrd.taiexhibition.view.CityHomeView;

/**
 * @author: ${唐杰}
 * @date: 2021/3/22
 */
public class CityPresener {
    private CityModel cityModel;
    private CityHomeView mCityHomeView;

    public CityPresener(CityHomeView mCityHomeView){
        this.mCityHomeView=mCityHomeView;
        this.cityModel=new CityModel();
    }


    public void getCityHome(int cityCode){
        cityModel.getHomeData(String.valueOf(cityCode), new MvpCallback<BeanCityHome>() {
            @Override
            public void onSuccess(BeanCityHome beanCityHome) {
                mCityHomeView.onSuccess(beanCityHome);
            }

            @Override
            public void onFailed(String e, int code) {
                mCityHomeView.onError(e,code);
            }
        });
    }
}
